﻿using CommonLib;
using CommonLib.Pattern.Pool;
using UnityEngine;

public class ReusableRoleSpeedItem : ReusableObject, IInitByInstruction
{
	RoleSpeedEffectItem roleSpeedEffect;

	public void Init(BPInstruction instruction)
	{
		roleSpeedEffect.Init(instruction);
	}
	protected override GameObject CreateSelf()
	{
		GameObject prefab = GameResourceLoader.Instance.LoadFromResource<GameObject>("ReusableObject/EffectSpeedPlus");
		//base.CreateSelf();
		IsCreated = true;
		roleSpeedEffect = Instantiate(prefab).GetComponent<RoleSpeedEffectItem>();
		roleSpeedEffect.EndAction += (self) =>
		{
			this.UnUse();
		};
		return roleSpeedEffect.gameObject;
	}
}
